<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="decorator" content="default"/>
 
	<title>添加冷链设备</title>	
	
	<script type="text/javascript">	
		$(document).ready(function() {
			
		});
				

			
		$(function(){
		
		//取消功能
			$("#cancelBtn").click(function(){
			 	window.parent.location.reload(); 
				var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
				parent.layer.close(index); //再执行关闭    
				
			});
			
		//保存功能	 
			$("#confirmBtn").click(function(){
				
				var equipmentId = $("#equipmentId").val();
				if(equipmentId==null||equipmentId.trim()==""){
					$.jBox.tip("设备编号不能为空");					
					return false;
				}	
			
				var name = $("#name").val();
				if(name==null||name.trim()==""){
					$.jBox.tip("设备名称不能为空");
					return false;
				}	
				
				var manufacturer = $("#manufacturer").val();
				if(manufacturer==null||manufacturer.trim()==""){
					$.jBox.tip("生产厂家不能为空");
				
					return false;
				}	
				
				var modelNumber = $("#modelNumber").val();
				if(modelNumber==null||modelNumber.trim()==""){
					$.jBox.tip("设备型号不能为空");
				
					return false;
				}	
			
				var factoryNum = $("#factoryNum").val();
				if(factoryNum==null||factoryNum.trim()==""){
					$.jBox.tip("出厂编号不能为空");
				
					return false;
				}	
				
				var refrigerationVolume = $("#refrigerationVolume").val();
				if(refrigerationVolume==null||refrigerationVolume.trim()==""){
					$.jBox.tip("冷藏容积不能为空");
					
					return false;
				}	
			
				var freezeVolume = $("#freezeVolume").val();
				if(freezeVolume==null||freezeVolume.trim()==""){
					$.jBox.tip("冷冻容积不能为空");
				
					return false;
				}	
				
				var arrivalDate = $("#arrivalDate").val();
				if(arrivalDate==null||arrivalDate.trim()==""){
					$.jBox.tip("到货日期不能为空");
					
					return false;
				}	
				
				var startuseDate = $("#startuseDate").val();
				if(startuseDate==null||startuseDate.trim()==""){
				$.jBox.tip("启用日期不能为空");
				
				return false;
				}	
				
				//成功关闭页面，存在不关闭页面				 
				window.parent.location.reload(); //刷新父页面
				var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
				parent.layer.close(index);  // 关闭layer 
				
				//提交form
				 var newAction="${ctx}/ccdeviceinfo/deviceInfo/insertDevice";  
				 $("#inputForm").attr('action',newAction);    //通过jquery为action属性赋值
       			 $("#inputForm").submit();    //提交ID为myform的表单 
       			 
       			 
			});
		});
	
		//默认时间
		<%   
          java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
          java.util.Date currentTime = new java.util.Date();//得到当前系统时间 
          String str_date = formatter.format(currentTime); //将日期时间格式化 
		 %> 
		 
	</script>
	<style type="text/css">
		body{
			color: #000000;
		}
	</style>
</head>
<body>
	<form id="inputForm" class ="inputForm"   method="post">
		
	<div class="breadcrumb">	
		<table class="table table-bordered">	
		<tr>
			<td><label>设备编号</label><span class="help-inline"><font color="red">*</font> </span></td>
			<td><input type="text" id="equipmentId" name="equipmentId"  size="20" maxlength="20" value=""  required/> </td>			
			<td><label>设备名称</label><span class="help-inline"><font color="red">*</font> </span></td>
			<!--  
			<td><input type="text" name="name" required="true" size="20" maxlength="20" value="" /> </td>		
			-->
			<td>
				<span style="font-size:12px;">
					<select id = "name" name = "name" style="width:220px;">  
			  			
			 			<option value="普通冷库">普通冷库</option>  
			 			<option value="低温冷库">低温冷库</option>  
			 			<option value="普通冰箱">普通冰箱</option>  
			 			<option value="冰衬冰箱">冰衬冰箱</option>  
			 			<option value="低温冰箱">低温冰箱</option>  
			 			<option value="冷藏箱">冷藏箱</option>  
			 			<option value="备用冷库制冷机组">备用冷库制冷机组</option>  
			 			<option value="发电机">发电机</option>  
			 			<option value="冷藏包">冷藏包</option>  
			 			<option value="疫苗运输车">疫苗运输车</option>  
			 			<option value="冷藏车">冷藏车</option>   
			 			<option value="其他">其他</option> 			
					</select>  
				</span></td>
				
		
		</tr>
		<tr>
			<td><label>品牌</label></td>			
			<td><input type="text" id="brand" name="brand" size="20" maxlength="20" value=""/> </td>			
			<td><label>来源</label></td>
	  		<td>
				<span style="font-size:12px;">
					<select id = "source" name = "source" style="width:220px;">  
			  			<option value="中央财政">中央财政</option>  
			 			<option value="省财政">省财政</option>  
			 			<option value="市财政">市财政</option>  
			 			<option value="县财政">县财政</option>  
			 			<option value="国际项目">国际项目</option>  
			 			<option value="自购">自购</option>   
			 			<option value="其他">其他</option> 			
					</select>  
				</span></td>
		</tr>
		<tr>
			<td><label>生产厂家</label><span class="help-inline"><font color="red">*</font> </span></td>
			<td><input type="text" id="manufacturer" name="manufacturer" required="true" size="20" maxlength="20" value=""/> </td>			
			<td><label>型号</label><span class="help-inline"><font color="red">*</font> </span></td>
			<td><input type="text" id="modelNumber" name="modelNumber" required="true" size="20" maxlength="20" value=""/> </td>	
		</tr>
		<tr>
			<td><label>出厂编号</label><span class="help-inline"><font color="red">*</font> </span></td>
			<td><input type="text" id="factoryNum" name="factoryNum" required="true" size="20" maxlength="20" value=""/> </td>			
			<td><label>冷藏包数量</label></td>
			<td><input type="number" id="coolbagNum" name="coolbagNum" size="20" maxlength="20" value=""/> </td>		
		</tr>
		<tr>
			<td><label>冷藏容积</label><span class="help-inline"><font color="red">*</font> </span></td>
			<td>
				<input type="number" id="refrigerationVolume" name="refrigerationVolume" required="true" style="width:100px;" size="20" maxlength="20" value=""/>
				<span style="font-size:12px;">
					<select id = "refrigerationUnit" name = "refrigerationUnit" style="width:100px;">  
		  			<option value="立方米">立方米</option>  
		 			<option value="升">升</option>  			
					</select>  
				</span>
			</td>			
			<td><label>冷冻容积</label><span class="help-inline"><font color="red">*</font> </span></td>
			<td>
				<input type="number" id="freezeVolume" name="freezeVolume" required="true" style="width:100px;" size="10" maxlength="20" value=""/> 
				<span style="font-size:12px;">
					<select id = "freezeUnit" name = "freezeUnit" style="width:100px;">  
		  			<option value="立方米">立方米</option>  
		 			<option value="升">升</option>  			
					</select>  
				</span>						
			</td> 					
		</tr>
		<tr>
			<td><label>出厂日期</label></td>
			<td><input type="datetime" id="productionDate" name="productionDate" style="width: 74%" class="Wdate"     onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  />  </td>
			<td><label>到货日期</label>
			 	<span class="help-inline"><font color="red">*</font> </span></td>
			<td><input type="datetime" id="arrivalDate" name="arrivalDate" required="true" style="width: 74%" class="Wdate"   value="<%=str_date%>"    onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  />  
			</td>
		</tr>
		<tr>
			<td><label>启用日期</label>
				<span class="help-inline"><font color="red">*</font> </span>
			</td>
			<td>
				 <input type="datetime" id="startuseDate" name="startuseDate" required="true" style="width: 74%" class="Wdate"   value="<%=str_date%>"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  />  
			</td> 
			<td><label>报废日期</label></td>
			<td>
				 <input type=datetime id="scrapDate" name="scrapDate" style="width: 74%" class="Wdate"     onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  />  
			</td> 
		</tr>
		<tr>			
			<td><label>状态</label></td>
			<td> 
				<span style="font-size:12px;">
					<select id = "status" name = "status" style="width:220px;">  
			  			<option value="正常">正常</option>  
			 			<option value="待修">待修</option>   	
			 			<option value="报废">报废</option>  
			 			<option value="停用">停用</option> 
	 			   </select>
	 			</span>
	 		</td> 
	 		<td><label></label></td>
			<td></td>	 							 
		</tr>						
	</table>	
	</div>
	
	<div style="margin-right:20px; margin-bottom: 10px;">
		<button  id="confirmBtn" style="margin-top: 20px;margin-left: 500px;"  class="btn btn-primary">保存</button> 
		<button id = "cancelBtn"  style="margin-top: 20px;margin-left: 20px;"  class="btn btn-default">取消</button>
	</div>
	</form>		
</body>
</html>
